<link href="css/style.css" rel="stylesheet" type="text/css" />
<?php 
		$daction = $_SESSION['action'];
	if(isset($_REQUEST['action'])){
		$daction = $_REQUEST['action'];
	}
	
		if($daction=="re_meeting_pending" ){
			mysql_query("UPDATE listapprove SET isView='1' WHERE (IDGroupApprove=(SELECT a.IDGroupApprove FROM approvedoc a WHERE a.IDApproveDoc='$id'));");
		}
		if($daction=="my_meeting_sending" ){
			mysql_query("UPDATE approvedoc SET isView='1' WHERE (IDApproveDoc='$id')");
		}
	$query = mysql_query("select a.Tile,a.Content,a.Timecreate,a.IDGroupApprove,a.IDEmployee from approvedoc a where a.IDApproveDoc = '$id'");
		while ($row = mysql_fetch_array($query))
		{
			$dtitle = $row['Tile'];
			$dcontent = $row['Content'];
			$dtime = $row['Timecreate'];
			$didgroupapprover = $row['IDGroupApprove'];
			
			$didemployee = $row['IDEmployee'];
		}
	$queryEmployee = mysql_query("SELECT e.FullName,dl.DepartmentName,e.Position 
				FROM employee e INNER JOIN department_lang dl ON dl.IDDepartment = e.IDDepartment
				WHERE e.IDEmployee = '$didemployee' AND dl.LangID = '$lang'");
		while ($row = mysql_fetch_array($queryEmployee))
		{
			$dnameemployee = $row['FullName'];
			$dnamedepartment = $row['DepartmentName'];
			$dposition = $row['Position'];
		}
	$queryApprove=mysql_query("SELECT e.FullName,dl.DepartmentName 
							FROM listapprove l,employee e,department_lang dl 
							WHERE l.IDEmployee=e.IDEmployee AND l.IDGroupApprove='$didgroupapprover' AND e.IDDepartment=dl.IDDepartment AND dl.LangID='$lang';");
	
	if(isset($_SERVER['HTTP_REFERER'])){
			$url=split('\&page=',$_SERVER['HTTP_REFERER']);
			$_SESSION['backpage']=$url[0];
		}
	?>
<style>.print{font-size:18px !important;margin:auto !important;width:90% !important;}
			.print table {border-collapse:collapse !important;width:90% !important;}
			.print td{border: 1px solid #999 !important;padding: 5px !important}
			
			.print td .first{
				background: #E8E8E8 !important; 
				padding:5px !important; 	
				font-weight:bold !important;; 
			}
			
</style>
<script>
			
			function printStart(){
				document.getElementById("header").style.display = "none";
				document.getElementById("menuleft").style.display = "none";
				document.getElementById("menu").style.display = "none";
				document.getElementById("footer").style.display = "none";
				document.getElementById("list").className="print";
				window.print();
				if(/Chrome/.test(navigator.userAgent)){
					  $(window).focus(function(){
						  location.reload(true);
					  });
					} else {
						  location.reload(true);
				}

			}
		
		</script>
<div class="title"></div>
<form action="approve-handle.php" method="post">
<input type="hidden" name="id" value="<?=$id?>" />
<input type="hidden" name="type" value="<?=$type?>" />
<input type="hidden" name="action" value="<?=$daction?>" />
<div class="main_content" style="min-height: 895px;background-color: white">
<div id="menu">
            <ul class="top_but">
	<?php if($daction=="re_not_approve"  || $daction=="my_saved"){?>
				<li><?php if(isset($_REQUEST['page'])){?>
						<input type="hidden" name="page" value="<?=$_REQUEST['page']?>" />
						<a href="<?=$_SESSION['backpage']?>&page=<?=$_REQUEST['page']?>"><img src="images/back.png" alt="" /></a>
					<?php }else{?>
						<a href="<?=$_SESSION['backpage']?>"><img src="images/back.png" alt="" /></a>
					<?php }?><p class="hidden"><?=$l_back?></p></li>
	<?php }else{?>
				<li><?php if(isset($_REQUEST['page'])){?>
						<input type="hidden" name="page" value="<?=$_REQUEST['page']?>" />
						<a href="<?=$_SESSION['backpage']?>&page=<?=$_REQUEST['page']?>"><img src="images/back.png" alt="" /></a>
					<?php }else{?>
						<a href="<?=$_SESSION['backpage']?>"><img src="images/back.png" alt="" /></a>
					<?php }?><p class="hidden"><?=$l_back?></p></li>
				<li><a href="printer/printer11.php?id=<?=$id?>&type=<?=$type?>" target="_blank"><img src="images/print.png" alt="" /></a><p class="hidden"><?=$l_print?></p></li>
	<?php }?>
	<?php
		if($daction=="my_meeting_sending" ){
			$_SESSION['idGroup']=$didgroupapprover;
			$_SESSION['id_employee']=$id_employee;
	?>
				<li><input type="submit" name="Delete" value="" style="background:url(images/trash.png) no-repeat; width:32px; height:32px; border:none; position:absolute; top:0px; left:0px; right:0px; bottom:0px; margin:auto" /><p class="hidden"><?php echo $l_delete?></p></li>
	<?php }?>
			</ul>
			</div>
			<div id="list">
            <table class="tcontent" cellpadding="5" cellspacing="0">
              <tr>
                <td class="col_left"><?=$l_title?></td>
                <td colspan="3"><div align="left"><?=$dtitle?></div></td>
              </tr>
              <tr>
                <td class="col_left" width="15%"><?=$l_employee?></td>
                <td colspan="3"><div align="left"><?=$dnameemployee?></div></td>
              </tr>
              <tr>
                <td class="col_left" width="15%"><?=$l_department?></td>
                <td colspan="3"><div align="left"><?=$dnamedepartment?></div></td>
              </tr>
              <tr>
                <td class="col_left" width="15%"><?=$_meetingdate?></td>
                <td colspan="3"><div align="left"><?=$dtime?></div></td>
              </tr>
              <tr>
                <td class="col_left" width="15%" ><?=$l_approver?></td>
                <td colspan="3" style="padding: 1px 1px">
                        <table class="tcontent" cellpadding="5" cellspacing="0">
                        	<?php 
                        		$i=1;
                        		while ($row=mysql_fetch_array($queryApprove)){?>
                        		<tr>
                        			<td style="padding: 5px 5px;color:blue;width: 100px "><?=$l_step?> <?=$i?> </td>
                        			<td style="padding:5px 5px;">
                        				<span style="display: block;">
                    					<b><?=$row[FullName]?></b>
	                    				</span>
                        			</td>
                        			<td style="padding: 5px 5px">
                        				<?=$row[DepartmentName]?>
                        			</td>
                        		</tr>
                           <?php $i++; }?>
                        </table>
                </td>
              </tr>
              <tr style="height: 300px;vertical-align: top;">
              
                  	<td colspan="5"><div align="left"><?=$dcontent?></div></td>
               </tr>
          </table>
          </div>
      </div>
 </form>